const path = require('path');
const fs = require('fs');
const moment = require('moment');

module.exports = (err) => {
    // 定义日志文件路径
    let logFilePath = path.join(__dirname, '../', 'logs', moment().format('YYYY-MM-DD') + '.log')
    // 读取日志文件
    let data = fs.readFileSync(logFilePath, 'utf-8')

    data = data.replace(/ok$/, err)
    // 将替换的新内筒写进日志文件中
    fs.writeFileSync(logFilePath, data, 'utf-8')
}